/*
 * @Author: wuzhen
 * @Date: 2019-01-22 09:08:17
 * @LastEditors  : wuzhen
 * @LastEditTime : 2020-01-06 10:24:12
 * @Description: vuex
 */
import Vue from "vue";
import Vuex from "vuex";
import vuexModules from "./modules";
import getters from "./getters";
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex);

const store = new Vuex.Store({
  modules: vuexModules,
  getters,
  plugins: [
    createPersistedState({
      reducer(val) {
        return {
          user: {
            token: val.user.token,
            userInfo: val.user.userInfo,
            routerMenus: val.user.routerMenus
          }
        };
      }
    })
  ]
});

export default store;
